<?php

namespace common\models\qywx;

use Yii;

/**
 * This is the model class for table "qywx_user".
 *
 * @property integer $id
 * @property string $userid
 * @property string $name
 * @property string $number
 * @property string $mobile
 * @property string $department
 * @property string $department_name
 * @property string $order
 * @property string $position
 * @property integer $gender
 * @property string $email
 * @property integer $is_leader
 * @property string $avatar
 * @property string $telephone
 * @property string $english_name
 * @property string $extattr
 * @property integer $status
 * @property string $memo
 * @property string $created_by
 * @property string $created_at
 * @property string $updated_by
 * @property string $updated_at
 */
class QywxUser extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'qywx_user';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name'], 'required'],
            [['gender', 'is_leader', 'status'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
            [['userid', 'number', 'department', 'department_name', 'order', 'position', 'email', 'avatar', 'memo'], 'string', 'max' => 255],
            [['name', 'mobile', 'telephone', 'english_name', 'extattr', 'created_by', 'updated_by'], 'string', 'max' => 45],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'userid' => Yii::t('app', 'Userid'),
            'name' => Yii::t('app', 'Name'),
            'number' => Yii::t('app', 'Number'),
            'mobile' => Yii::t('app', 'Mobile'),
            'department' => Yii::t('app', 'Department'),
            'department_name' => Yii::t('app', 'Department Name'),
            'order' => Yii::t('app', 'Order'),
            'position' => Yii::t('app', 'Position'),
            'gender' => Yii::t('app', 'Gender'),
            'email' => Yii::t('app', 'Email'),
            'is_leader' => Yii::t('app', 'Is Leader'),
            'avatar' => Yii::t('app', 'Avatar'),
            'telephone' => Yii::t('app', 'Telephone'),
            'english_name' => Yii::t('app', 'English Name'),
            'extattr' => Yii::t('app', 'Extattr'),
            'status' => Yii::t('app', 'Status'),
            'memo' => Yii::t('app', 'Memo'),
            'created_by' => Yii::t('app', 'Created By'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_by' => Yii::t('app', 'Updated By'),
            'updated_at' => Yii::t('app', 'Updated At'),
        ];
    }

    public function getPrintName(){
        return sprintf('姓名: %s', $this->name);
    }
}
